/*
 * @Description: 数据模型
 * @Author: wind-lc
 * @version: 1.0
 * @Date: 2022-03-15 16:26:41
 * @LastEditTime: 2022-04-01 15:45:34
 * @FilePath: \cscec-pms-admin\src\views\project\plannManagement\plannTableSummary\model.js
 */
import SelectSubCompany from '@/components/Select/SelectSubCompany'
import SelectProject from '@/components/Select/SelectProject'
import OrgTreeSelect from '@/components/OrgTreeSelect'
// 状态
const status = [
  {
    value: 0,
    label: '待签收'
  },
  {
    value: 1,
    label: '待提交'
  },
  {
    value: 2,
    label: '审核中'
  },
  {
    value: 3,
    label: '审核通过'
  },
  {
    value: 4,
    label: '审核不通过'
  }
]
const status1 = [
  {
    value: 0,
    label: '待提交'
  },
  {
    value: 1,
    label: '审核中'
  },
  {
    value: 2,
    label: '审核不通过'
  },
  {
    value: 3,
    label: '审核通过'
  },
]
// 工程策划表汇总搜索选项
const searchOption = [
  {
    name: '所属单位',
    valueKey: 'searchQuery',
    type: OrgTreeSelect,
  },
  // {
  //   name: '所属分公司',
  //   valueKey: 'branchComId',
  //   type: SelectSubCompany
  // },
  // {
  //   name: '所属项目',
  //   keyValue: 'branchComId',
  //   valueKey: 'projectId',
  //   type: SelectProject
  // },
  {
    name: '创建时间',
    value: 'createTime',
    type: 'dateRange',
    attr: {
      rangeFormat: ['createStartTime', 'createEndTime']
    }
  },
  {
    name: '状态',
    value: 'status',
    type: 'select',
    data: status1
  }
]
// 项目管理策划明细表表头
const columns = [
  {
    title: '项目名称',
    ellipsis: true,
    width: 100,
    dataIndex: 'projectName'
  },
  {
    title: '所属分公司',
    ellipsis: true,
    width: 120,
    dataIndex: 'branchName'
  },
  {
    title: '创建时间',
    ellipsis: true,
    width: 110,
    dataIndex: 'createTime'
  },
  {
    title: '填写人',
    ellipsis: true,
    width: 110,
    dataIndex: 'fillName'
  },
  {
    title: '填写时间',
    ellipsis: true,
    width: 110,
    dataIndex: 'fillTime'
  },
  {
    title: '状态',
    dataIndex: 'status',
    width: 120,
    align: 'center',
    customRender: (text) => {
      return status1.find(el => el.value === text)?.label
    }
  },
  {
    title: '操作',
    dataIndex: 'operation',
    width: 180,
    fixed: 'right',
    align: 'center',
    scopedSlots: { customRender: 'operation' }
  }
]
// 工程策划表基本信息表单项
const formOption = [
  {
      label: '所属单位',
      keyName: 'projectId',
      type: 'orgTree',
      needTags: ['BC', 'PD'],
      disabled: true
  },
  {
    label: '项目编号',
    keyName: 'projectCode',
    type: 'BaseInput',
    disabled: true
  },
  {
    label: '编制人',
    keyName: 'fillName',
    type: 'BaseInput',
    disabled: true
  },
  {
    label: '编制时间',
    keyName: 'fillTime',
    type: 'BaseInput',
    disabled: true
  }
]
// 策划明细表表头
const columns1 = [
  {
    title: '序号',
    width: 80,
    align: 'center',
    customRender: (text, record, index) => {
      return index + 1
    }
  },
  {
    title: '工程策划名称',
    dataIndex: 'schemeName'
  },
  {
    title: '填报人',
    dataIndex: 'fillName'
  },
  {
    title: '填报时间',
    dataIndex: 'fillTime'
  },
  {
    title: '版本信息',
    dataIndex: 'version',
    width: 100,
    align: 'center',
    scopedSlots: { customRender: 'version' }
  },
  {
    title: '状态',
    dataIndex: 'status',
    width: 120,
    align: 'center',
    customRender: (text, row) => {
      return row.type === 0 ? status.find(el => el.value === text)?.label : text === 0 ? '待提交' : '已提交'
    }
  },
  {
    title: '操作',
    dataIndex: 'operation',
    width: 180,
    fixed: 'right',
    align: 'center',
    scopedSlots: { customRender: 'operation' }
  }
]
// 版本信息表头
const columns2 = [
  {
    title: '序号',
    width: 80,
    align: 'center',
    customRender: (text, record, index) => {
      return index + 1
    }
  },
  {
    title: '版本号',
    dataIndex: 'version',
    customRender: (text) => {
      return 'V' + text
    }
  },
  {
    title: '版本创建时间',
    dataIndex: 'fillTime'
  },
  {
    title: '创建人',
    dataIndex: 'fillName'
  },
  {
    title: '操作',
    dataIndex: 'operation',
    width: 120,
    fixed: 'right',
    scopedSlots: { customRender: 'operation' }
  }
]
export {
  searchOption,
  columns,
  formOption,
  columns1,
  columns2
}
